package api;

import java.util.Random;
import java.util.Scanner;

public class Day01扩展练习 {
    public static void main(String[] args) {
        String verificationCode = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        Random rand = new Random();
        Scanner scan = new Scanner(System.in);
        String show = "";
        for (int i = 0; i < 6; i++) {
            int index = rand.nextInt(62);
            char a = verificationCode.charAt(index);
            show += a;
        }
        System.out.println("验证码："+show);
        String contrast1 = show.toUpperCase();
        System.out.println("请输入验证码，不区分大小写");
        String input = scan.nextLine();
        String contrast2 = input.toUpperCase();
        if (contrast1.equals(contrast2)) {
            System.out.println("验证成功");
        }else {
            System.out.println("验证失败");
        }
    }
}
